﻿using AutoMapper;
using Decoration.Models.Dto;
using Decoration.Models.DTO;
using Decoration.Models.Models;

namespace Decoration.Api.AutoMapper
{
    public class DTO2POMappingProfile:Profile
    {
        public DTO2POMappingProfile()
        {
            //CreateMap<DictInfoBo, Base_DictInfo>().ReverseMap();
            CreateMap<BusinessInfo, BusinessPostDto>().ReverseMap();

            CreateMap<ProcedureInfo,ProcedurePostDto>().ReverseMap();

            CreateMap<CustomerInfo,CustomerPostDto>().ReverseMap();

            CreateMap<ProductInfo, ProductPostDto>().ReverseMap();

            CreateMap<OrderInfo,OrderProjectPostDto>().ReverseMap();
            CreateMap<ProjectInfo,ProjectPostDto>().ReverseMap();

            CreateMap<OrderInfo, OrderPutOrder>().ReverseMap();

            CreateMap<OrderDetail,OrderDetailPostDto>().ReverseMap();

            CreateMap<UserProcedurePostDto, UserProcedure>()
                .ForMember(d=>d.BeginDate,s=>s.MapFrom(o=>DateOnly.FromDateTime(o.BeginDate)))
                .ForMember(d => d.EndDate, s => s.MapFrom(o => DateOnly.FromDateTime(o.EndDate))).ReverseMap();

            CreateMap<LoginPutDto,Base_LoginInfo>().ReverseMap();

            CreateMap<UserProcedureRecordPostDto, UserProcedureRecord>().ReverseMap();

            CreateMap<DelayPostDto, DelayInfo>()
                .ForMember(d=>d.EndDate,s=>s.MapFrom(o=>DateOnly.FromDateTime(o.EndDate)))
                .ReverseMap();
            CreateMap<TransferPostDto, TransferInfo>()
               .ReverseMap();
        }
    }
}
